<?php
define('web_s', 'johnsongod');
$common['cururl'] = 'show';
$common['title'] = '首页';
require 'includes/init.php';

$goods_id = isset($_REQUEST['goods_id']) ? $_REQUEST['goods_id'] : '';
$error = FALSE;
if(!$goods_id){
	$error = TRUE;
}else{
	$goods = $db->getRow("select * from m_goods where goods_id = '{$goods_id}'");
	if(!$goods){
		$error = TRUE;
	}else{
		$goods_pic = $db->getAll("select * from m_goods_pic where goods_id = '{$goods_id}' order by id asc limit 5");
	}
}

if($error){
	$common['cururl'] = '404';
	$smarty->assign('common', $common);
	@header('HTTP/1.1 404 Not Found');
	@header('Status: 404 Not Found');
	$smarty->display('404.htm');
	exit;
}

$commentlist = $db->getAll("select * from m_comment where goods_id = '{$goods_id}'");

$smarty->assign('commentlist', $commentlist);
$smarty->assign('goods', $goods);
$smarty->assign('goods_pic', $goods_pic);

$smarty->display("show.htm");